/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package icardexswingui;

import java.awt.Component;
import java.util.HashMap;
import javax.swing.JComboBox;
import javax.swing.JTable;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellRenderer;

/**
 *
 * @author Bageshwar
 */
public class ListModel implements TableCellRenderer,TableModelListener {

    public HashMap<String, JComboBox> map;

    private DefaultTableCellRenderer d;

    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        //throw new UnsupportedOperationException("Not supported yet.");

        //return a Combobox;
        System.out.println(value);
        System.out.println(row + ":" + column);
        if(column !=0)
        return map.get(value.toString());
        else return d.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    }

    public ListModel() {
        map = new HashMap<String, JComboBox>();
        d = new DefaultTableCellRenderer();
    }

    public void tableChanged(TableModelEvent e) {

        System.out.println("Time to load some data !!!");
    }
}
